package org.javaqq.face.main.base;

import java.util.List;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultListModel;

public class SearchListModel extends DefaultListModel implements ComboBoxModel {
	Object currentValue;
	
	public SearchListModel(List list){
		for (int i = 0, n = list.size(); i < n; i++) {
	        addElement(list.get(i));
	      }
	}
	
	public SearchListModel(){
		super();
	}

	@Override
	public void setSelectedItem(Object anObject) {
		currentValue = anObject;
	    fireContentsChanged(this, -1, -1);
	}

	@Override
	public Object getSelectedItem() {
		return currentValue;
	}

}
